# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: neodreams <yanbrodeur@gmail.com>

pkgname=giggle
pkgver=0.7
pkgrel=11
pkgdesc='Git repository viewer'
arch=(loong64 x86_64)
url='https://wiki.gnome.org/Apps/giggle'
license=(GPL)
depends=(git gtksourceview3 vte3)
makedepends=(intltool itstool gnome-common yelp-tools)
source=("https://download.gnome.org/sources/$pkgname/$pkgver/$pkgname-$pkgver.tar.xz"
        giggle.appdata.xml
        gtksourceview3.7.patch
        vte2.91.patch)
sha256sums=('ae2e2237fa0d0999d99d0a0ee9b7ec147e80bd2472d59a045b2b01eb02261f59'
            '52bc930fe0e981bc14722b842cf2a57e645509853a642692d73f14462b3522be'
            'a29cc899d17645d43a39ac94551c4af896f67983c40fab3bfc585881217f30df'
            'eec654cd3ec31144461cbfc01f4c0b6690e0cdd1b08e057cd5afe99acc17dfed')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../gtksourceview3.7.patch
  patch -Np1 -i ../vte2.91.patch
  NOCONFIGURE=1 AUTOPOINT=intltoolize gnome-autogen.sh
}

build() {
  cd $pkgname-$pkgver
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  ./configure --prefix=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd $pkgname-$pkgver
  make -k check
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -Dm644 ../giggle.appdata.xml "$pkgdir/usr/share/metainfo/giggle.appdata.xml"
}
